from selenium import webdriver  
from selenium.webdriver import FirefoxOptions  
from selenium.webdriver.firefox.service import Service  
from webdriver_manager.firefox import GeckoDriverManager
import subprocess  

opts = FirefoxOptions()  
opts.add_argument("--headless")  

# log path './geckodriver.log'
service = webdriver.FirefoxService(executable_path=GeckoDriverManager().install(), log_path=subprocess.STDOUT, service_args=['--log', 'trace'])
browser = webdriver.Firefox(service=service, options=opts)  

browser.get('http://baidu.com')